package io.bdmc.common.http;

import java.util.HashMap;
import java.util.LinkedHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import io.bdmc.common.utils.Constant;
import io.bdmc.common.utils.RedisUtils;

@Service
public class HKHttpUtil {
    public static final Logger logger = LoggerFactory.getLogger((ZxyHttpUtil.class));

    @Autowired
    private HttpClientUtil _httpSvs;

    @Autowired
    public RedisUtils _redis;

   // private static String deviceApi =Constant.nbiotDomain + "/devices/";// 设备


    public HttpResult deleteDevice(String deviceId) {
        HashMap<String, String> headers = new LinkedHashMap<>();
        headers.put("api-key", Constant.nbiotApiKey);
        try { 
            String url = Constant.nbiotDomain+ "/devices/"+deviceId;
           return  _httpSvs.doDelete(url, headers);
        } catch (Exception e) {
            return null;
        }
    }

   
    public HttpResult queryDevice(String imei) {
        HashMap<String, String> headers = new LinkedHashMap<>();
        headers.put("api-key", Constant.nbiotApiKey);
        try {
            String url = Constant.nbiotDomain+ "/devices/"+"getbyimei?imei="+imei;
           return  _httpSvs.doGet(url, headers);
        } catch (Exception e) {
            return null;
        }
    }
}